package com.xqboss.common.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 身份晋升-相关身份段位的img
 */
public class IdentityImgUtil {

    private static final String DNS = "http://img.17jyw.com/";

    private static final String PROJECT_URL = "identify-img/";

    private static final String URL = DNS+PROJECT_URL;

    /*说明：普通水友-身份段位；lv.1-当前身份段位的等级（没有等级就没有lv.1）;false-是否显示身份晋升按钮；*/
    private static final Map<String,String> IMG_CHINESE = new HashMap<String,String>(26){{
        put("蛙星人false","ptsy.png");
        put("蛙星人true","ptsyup.png");
        put("生产者false","scz.png");
        put("生产者true","sczup.png");
        put("竞技者lv.1false","jjz1.png");
        put("竞技者lv.2false","jjz2.png");
        put("竞技者lv.3false","jjz3.png");
        put("竞技者lv.4false","jjz4.png");
        put("竞技者lv.5false","jjz5.png");
        put("竞技者lv.6false","jjz6.png");
        put("竞技者lv.7false","jjz7.png");
        put("竞技者lv.8false","jjz8.png");
        put("竞技者lv.9false","jjz9.png");
        put("竞技者lv.1true","jjzup1.png");
        put("竞技者lv.2true","jjzup2.png");
        put("竞技者lv.3true","jjzup3.png");
        put("竞技者lv.4true","jjzup4.png");
        put("竞技者lv.5true","jjzup5.png");
        put("竞技者lv.6true","jjzup6.png");
        put("竞技者lv.7true","jjzup7.png");
        put("竞技者lv.8true","jjzup8.png");
        put("竞技者lv.9true","jjzup9.png");
        put("经商者false","jsz.png");
        put("经商者true","jszup.png");
        put("建设者false","jzz.png");
        put("建设者true","jzzup.png");
    }};

    /*说明：普通水友-身份段位；lv.1-当前身份段位的等级（没有等级就没有lv.1）;false-是否显示身份晋升按钮；*/
    private static final Map<String,String> IMG_CHINESE_NO = new HashMap<String,String>(26){{
        put("蛙星人","noptsy.png");
        put("生产者","noscz.png");
        put("竞技者lv.1","nojjz1.png");
        put("竞技者lv.2","nojjz2.png");
        put("竞技者lv.3","nojjz3.png");
        put("竞技者lv.4","nojjz4.png");
        put("竞技者lv.5","nojjz5.png");
        put("竞技者lv.6","nojjz6.png");
        put("竞技者lv.7","nojjz7.png");
        put("竞技者lv.8","nojjz8.png");
        put("竞技者lv.9","nojjz9.png");
        put("经商者","nojsz.png");
        put("建设者","nojzz.png");
    }};

    /**
     * 按中文身份段位名称获取对应的图片名称(身份晋升使用)
     *
     * @param name 身份段位 、是否展示升级晋升按钮
     * @return 身份段位url地址
     */
    private static String getIdentityRankImaUrl(String name){
        return URL+IMG_CHINESE.get(name);
    }

    /**
     * 按中文身份段位名称获取对应的图片名称(扳手工厂)
     *
     * @param name 身份段位 、是否展示升级晋升按钮
     * @return 身份段位url地址
     */
    public static String getIdentityRankImaUrlNo(String name){
        return URL+IMG_CHINESE_NO.get(name);
    }

    /**
     * 获取对应身份段位的图片地址
     *
     * @param currentIdentity 当前身份段位
     * @param isIdentityPromotion 是否具备身份晋升的条件（true-具备）
     * @return 身份段位的图片地址
     */
    public static String getIdentityRankImaUrl(String currentIdentity,boolean isIdentityPromotion){
        return getIdentityRankImaUrl(currentIdentity+isIdentityPromotion);
    }

}
